package stock;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

public class Main {

	public static void main(String[] args) {
		User[] users = { new User("Alice", 10.5f, "Class A"), new User("Bob", 8.2f, "Class B"),
				new User("Charlie", 7.3f, "Class A"), new User("David", 6.9f, "Class B") };

		Stock[] stockarr  = new Stock[] {};
		
		Map<String, Double> valueSumByClass = Arrays.stream(stockarr)
				.collect(Collectors.groupingBy(Stock::getCode, Collectors.summingDouble(Stock::getZhandifu)));

		System.out.println(valueSumByClass);
		
		
		
	}

	static class User {
		private final String name;
		private final float value;
		private final String classroom;

		public User(String name, float value, String classroom) {
			this.name = name;
			this.value = value;
			this.classroom = classroom;
		}

		public String getName() {
			return name;
		}

		public float getValue() {
			return value;
		}

		public String getClassroom() {
			return classroom;
		}
	}
}
